<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a = "12.92";
        var b = "9.87";
        if(a<b){
            alert("字符串比较");
            console.log(typeof(a));
            console.log(typeof(b));
        }
        var c = Number(a);
        var d = Number(b);
        if(c<d){
            alert("数字比较");
            console.log(typeof(c));
            console.log(typeof(d));
        }
    </script>
</body>
</html>